package com.itic.mall.system.service;

import com.itic.appbase.framework.common.constants.DBConst;
import com.itic.appbase.framework.common.service.CrudService;
import com.itic.mall.system.share.sharehistory.persistence.dao.ShareHistoryDao;
import com.itic.mall.system.share.sharehistory.persistence.model.ShareHistory;
import com.itic.mall.system.share.sharehistory.persistence.model.ShareHistoryExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional
public class ShareHistoryService
     extends CrudService<ShareHistoryDao,ShareHistory,ShareHistoryExample> implements com.itic.mall.system.inter.service.ShareHistoryService{
    @Autowired
    private ShareHistoryDao shareHistoryDao;

	public List<ShareHistory> listBySpuIdAndUserId(String spuId, String userId) {
		ShareHistoryExample example = new ShareHistoryExample();
		com.itic.mall.system.share.sharehistory.persistence.model.ShareHistoryExample.Criteria criteria = example.createCriteria();
		criteria.andIsEffectiveEqualTo(DBConst.TRUE);
		criteria.andUserIdEqualTo( userId );
		criteria.andSpuIdEqualTo( spuId );
		return shareHistoryDao.selectByExample(example);
	}

}